//
//  DetailGoodsViewController.m
//  星期6
//
//  Created by 宗镇荣 on 16/2/25.
//  Copyright © 2016年 zzr. All rights reserved.
//

#import "DetailGoodsViewController.h"
#import "CommonDefin.h"
#import "GoodsModel+net.h"
#import "CollectionDbManager.h"

@interface DetailGoodsViewController ()

@property (nonatomic)UIWebView *webView;

@end

@implementation DetailGoodsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    _webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - 64)];
    [self.view addSubview:_webView];
    
    NSURL *url = [NSURL URLWithString:self.url];
    NSURLRequest *request = [NSURLRequest requestWithURL:url];
    [_webView loadRequest:request];
    
    //self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"common_tabBar_follow"] style:UIBarButtonItemStylePlain target:self action:@selector(barbuttonNoClick:)];
    self.navigationItem.rightBarButtonItem = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"common_tabBar_follow_light"] style:UIBarButtonItemStyleDone target:self action:@selector(barbuttonClick:)];
    [GoodsModel requestPage:nil completionBlock:^(NSMutableArray *array, NSError *error) {
        for (GoodsModel *model in array) {
            
            self.model = model;
        }
    }];
    
}


- (void)barbuttonClick:(UIButton *)btn {

    CollectionDbManager *dbManager = [CollectionDbManager sharedCollectionDbManager];
    
    [dbManager insetModel:self.model];

}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
